<template>
  <div class="box"></div>
  <Row>
    <Button type="default" @click="add">操作</Button>
  </Row>
</template>
<script>
export default {
  data() {
    return {
      a: 1,
      b: 2
    }
  },
  methods: {
    add() {
      console.log(`helloworld`)
      console.log(`111`)
      // debugger
      try {
        console.log(abc)
      } catch (error) {
        console.log(error)
        console.trace(`请测试`)
      }
    },
    addANewMethod() {
      console.log(`这里添加了一个新的方法`)
    }
  },
  mounted() {
    // console.trace(catching_num)
    // 检查变量属性描述符
    const descriptor = Object.getOwnPropertyDescriptor(window, 'catching_num')
    window.catching_num = 999
    //console.log(descriptor)
    this.add()

    const obj = {
      a: 1,
      b: 2
    }

    const proxy = new Proxy(obj, {
      set(target, property, value, receiver) {
        console.log(`改变了`, property)
        return Reflect.set(target, property, value, receiver)
      }
    })

    proxy.c = 999
    proxy.d = 1100
  }
}
</script>

<style lang="scss" scoped>
.box {
  width: 100px;
  height: 100px;
  border: 1px solid #000;
}
</style>
